home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
5_5.lha
/
5_5
/
5_5e3.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
628b
|
32 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
tatic tree* get_expr(istream& input)
tree* left = term(input);
for (;;)
switch (curr_tok.type)
{
case PLUS:
plus_op *headp = new plus_op;
headp->left = left;
get_token(input); // eat '+'
headp->right = term(input);
left = headp;
break;
case MINUS:
binary_minus_op* headm = new binary_minus_op;
headm->left = left;
get_token(input); // eat '-'
headm->right = term(input);
left = headm;
break;
default: // collapse node
return left;
}